<!--
 * @Description: 
 * @Author: charles
 * @Date: 2020-11-03 14:04:56
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-09-30 09:56:55
-->
<template>
  <div>
    <div class="header">
      <div class="h_title">{{resData.name}}</div>
      <div class="h_date">{{fmtDate(resData.beginTime)}}~{{fmtDate(resData.endTime)}} | {{resData.region}}</div>
    </div>
    <div class="content" v-html='resData.details'></div>
    <div class="footer">
      <el-button type='primary' plain @click='goBackHome'>返回</el-button>
    </div>
  </div>
</template>
<script>
import request from '../utils/request'
import moment from 'moment'
export default {
  data(){
    return {
      id:null,
      resData:{}
    }
  },
  methods:{
    findProjectById(){
      //ajax请求要先引入request
      request.get('./index/project/findById?id='+this.id).then(res=>{
        this.resData=res.data;
      })
    },
    fmtDate(time){
      return this.$moment(time).format('YYYY_MM_DD HH:mm:ss');
    },
    goBackHome(){
      //go(-1)代表在浏览器的历史记录中返回上一条记录
      this.$router.go(-1);
    }
  },
  created(){   //生命周期构造函数
    // 在当前钩子函数中接受路由跳转传递过来的参数
    //console.log(this.$route.query);  //得到详情页面的id
    this.id=this.$route.query.id;//把跳转携带过来的参数赋值给this.id
    this.findProjectById();
  }
}
</script>
<style scoped>
.header{
  text-align: center;
}
.h_title{
  font-size: 22px;
  font-weight: bold;
  height: 50px;
  list-style: 50px;
}
.content{
  text-align: center;
  padding: 50px 100px;
  font-size: 18px;
  font-weight: bold;
}
.footer{
  text-align: center;
  height: 100px;
}
</style>